HTML - tags - tr tag

revision:


Content

syntax some examples


"tr" tag : defines a row in a HTML table

top

The <tr> tag defines a row in an HTML table. The <tr> element contains one or more <th> or <td> elements. All the rows in a table contain an equal number of cells, which is equivalent to the number of cells in the longest row.
If there are fewer cells in a row, then the browser will automatically fill the row, placing empty cells at the end of it.
If you need to emphasize that there is no data in other cells, then create cells without content where necessary.

Attributes: the <tr> element supports the global attributes and events attributes.


Syntax

top

<tr> . . . </tr>


some examples

top
Month Savings
January $100
January $80
Codes:
                  <style>
                      table, th, td {border: 1px solid black;margin-left: 4vw;}
                  </style>
                  <table>
                      <tr>
                          <th>Month</th>
                          <th>Savings</th>
                      </tr>
                      <tr>
                          <td>January</td>
                          <td>$100</td>
                      </tr>
                      <tr>
                          <td>January</td>
                          <td>$80</td>
                      </tr>
                  </table>
              
Month Savings
January $100
Codes:
                  <table style="width:100%">
                      <tr>
                        <th>Month</th>
                        <th>Savings</th>
                      </tr>
                      <tr style="text-align:right">
                        <td>January</td>
                        <td>$100</td>
                      </tr>
                  </table>